package com.tianji.learning.controller;


import com.tianji.learning.domain.dto.LearningLessonDTO;
import com.tianji.learning.domain.dto.LearningRecordFormDTO;
import com.tianji.learning.service.ILearningRecordService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 * 学习记录表 前端控制器
 * </p>
 *
 * @author 陈宽
 * @since 2025-06-28
 */
@RestController
@RequestMapping("/learning-records")
@RequiredArgsConstructor
public class LearningRecordController {
    private final ILearningRecordService learningRecordService;
    // 获取当前用户学习进度
    @GetMapping("/course/{courseId}")
    public LearningLessonDTO getLearningLesson(@PathVariable Long courseId) {
        return learningRecordService.getLearningLesson(courseId);
    }
    @PostMapping
    public void submitLearningRecord(@RequestBody LearningRecordFormDTO dto){
        learningRecordService.submitLearningRecord(dto);
    }
}
